<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminLaoren/index')}">老人列表</a></li>
        <li><a href="{:url('AdminLaoren/add')}">添加老人信息</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminLaoren/index')}" id="search">
        <input type="hidden" name="pagenum" value="{$pagenum|default='10'}" id="pagenum">
        地区:
        <input class="form-control" type="text" style="width:300px;" required value="" placeholder="请选择社区"
            onclick="doSelectCategory();" id="js-categories-name-input" readonly />
        <input class="form-control" type="hidden" value="" name="category" id="js-categories-id-input" />
        姓名:
        <input type="text" class="form-control" name="keyword" style="width: 200px;"
               value="{$keyword|default=''}" placeholder="请输入关键字">
        身份证号:
        <input type="text" class="form-control" name="zjnum" style="width: 200px;" value="{$zjnum|default=''}"
            placeholder="请输入身份证号">
        <button class="btn btn-primary">搜索</button>
        <a class="btn btn-primary  js-ajax-dialog-url"
            href="{:url('AdminLaoren/qingkong')}" data-msg="确定清空所有老人余额？">清空余额</a>
<a class="btn btn-primary" href="../../upload/oldman.xlsx">下载模板</a>
<a class="btn btn-primary" href="{:url('AdminLaoren/daoru')}">批量导入</a>
            <a class="btn btn-primary js-ajax-dialog-url" href="{:url('AdminLaoren/daochu')}" data-msg="确定导出数据吗？">导出</a>
    </form>
    <form class="js-ajax-form" method="post">
        <div class="table-actions">
            <table>
                <tr>
                    <td width="100">
                        <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminLaoren/delete')}"
                            data-subcheck="true" data-msg="{:lang('DELETE_CONFIRM_MESSAGE')}">{:lang('DELETE')}
                        </button>
                    </td>
                    <td width="100">批量充值：</td>
                    <td width="180"><input type="text" class="form-control" name="plczmoney" style="width: 150px;" value="0" placeholder="请输入充值金额"></td>
                    <td width="300">
                        <button class="btn btn-primary js-ajax-submit" type="submit" data-action="{:url('AdminLaoren/plcz')}"
                        data-subcheck="true" data-msg="确定批量充值吗">批量充值
                    </button></td>
                    <td></td>
                </tr>
            </table>
            
            
            
        </div>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="80">序号</th>
                <th width="80">老人编号</th>
                <th  width="160">姓名</th>
                <th width="160">性别</th>
                <th width="160">年龄</th>
                <th width="160">街道社区</th>
                <th width="160">身份证号</th>
                <th width="160">老人类型</th>
                <th width="160">住址</th>
                <th width="160">卡号</th>
                <th width="100">余额</th>
                <th width="200">操作</th>
            </tr>
            </thead>
            <php>$status=array("1"=>'已发布',"0"=>'未发布');</php>
            <foreach name="pages" key="key" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}">
                    </td>
                    <td>{$xhpage + $key}</td>
                    <td>{$vo.more.bianma}</td>
                    <td>
                            {$vo.post_title}
                    </td>
                    <td>{$vo.more.sex}</td>
                    <td>{$ageArray[$key]}</td>
                    <td>
                        <foreach name="vo.categories" item="voo">

                        {$voo.name}
                    </foreach></td>
                    <td>{$vo.more.zjnum}</td>
                    <td>{$vo.more.butietype|default=''}</td>
                    <td>{$vo.more.add}</td>
                    <td>{$vo.more.dbznum}</td>
                    <td>{$vo.money}</td>
                    <td>
                        <a class="btn btn-xs btn-primary" href="{:url('AdminLaoren/edit',array('id'=>$vo['id']))}">{:lang('EDIT')}</a>
                        <a class="btn btn-xs btn-primary" href="{:url('AdminLaoren/chongzhi',array('id'=>$vo['id']))}">充值</a>
                        <a class="btn btn-xs btn-primary" href="{:url('AdminLaoren/czlist',array('id'=>$vo['id']))}">充值记录</a>
                        <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/mdorderlist',array('strats'=>1,'lrid'=>$vo['id']))}">消费记录</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminLaoren/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
                        <a class="btn btn-xs btn-danger js-ajax-qingkong" href="{:url('AdminLaoren/qingkongById',array('id'=>$vo['id']))}">清空余额</a>
                    </td>
                </tr>
            </foreach>
            <!-- <tfoot>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="100">ID</th>
                <th width="80">老人编号</th>
                <th  width="160">姓名</th>
                <th width="160">性别</th>
                <th width="160">年龄</th>
                <th width="160">老人类型</th>
                <th width="160">出生日期</th>
                <th width="160">卡号</th>
                <th width="100">余额</th>
                <th width="80">状态</th>
                <th width="200">操作</th>
            </tr>
            </tfoot> -->
        </table>
       
        <div class="table-actions">
            每页条数： <select style="width: 100px; " name="pagenum" onchange="changePage(this);">
                <option value="10">10</option>
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
                <option value="500">500</option>
                <option value="1000">1000</option>
            </select><br>
            <div class="pagination">{$page}</div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js?v=2"></script>
<script type="text/javascript">
   $('select[name=pagenum]').val("{$pagenum|default='10'}");
    function doSelectCategory() {
        var selectedCategoriesId = $('#js-categories-id-input').val();
        openIframeLayer("{:url('AdminCategory/sqselect')}?ids=3,4,5,6,7,8,9,10,11&yxid=" + selectedCategoriesId, '请选择社区', {
            area: ['700px', '400px'],
            btn: ['确定', '取消'],
            yes: function (index, layero) {
                //do something

                var iframeWin = window[layero.find('iframe')[0]['name']];
                var selectedCategories = iframeWin.confirm();
                if (selectedCategories.selectedCategoriesId.length == 0) {
                    layer.msg('请选择社区');
                    return;
                }
                $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
                $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
                //console.log(layer.getFrameIndex(index));
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });
    }

    function changePage(num) {
        $('#pagenum').val(num.value);
        var params=getFormParam();
        window.location.href='?'+params;
    }
    function getFormParam(){
        var params = $('#search').serialize(); 
        return params;
    }

</script>
</body>
</html>